Integrand size = 21, antiderivative size = 46 \[ \int \sin ^2(e+f x) \left (a+b \tan ^2(e+f x)\right ) \, dx=\frac {1}{2} (a-3 b) x-\frac {(a-b) \cos (e+f x) \sin (e+f x)}{2 f}+\frac {b \tan (e+f x)}{f} \]
Time = 0.50 (sec) , antiderivative size = 43, normalized size of antiderivative = 0.93 \[ \int \sin ^2(e+f x) \left (a+b \tan ^2(e+f x)\right ) \, dx=\frac {2 (a-3 b) (e+f x)+(-a+b) \sin (2 (e+f x))+4 b \tan (e+f x)}{4 f} \]
Time = 0.23 (sec) , antiderivative size = 59, normalized size of antiderivative = 1.28, number of steps used = 7, number of rules used = 6, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.286, Rules used = {3042, 4146, 360, 25, 299, 216}
Below are the steps used by Rubi to obtain the solution. The rule number used for the transformation is given above next to the arrow. The rules definitions used are listed below.
\(\displaystyle \int \sin ^2(e+f x) \left (a+b \tan ^2(e+f x)\right ) \, dx\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle \int \sin (e+f x)^2 \left (a+b \tan (e+f x)^2\right )dx\) |
\(\Big \downarrow \) 4146 |
\(\displaystyle \frac {\int \frac {\tan ^2(e+f x) \left (b \tan ^2(e+f x)+a\right )}{\left (\tan ^2(e+f x)+1\right )^2}d\tan (e+f x)}{f}\) |
\(\Big \downarrow \) 360 |
\(\displaystyle \frac {-\frac {1}{2} \int -\frac {2 b \tan ^2(e+f x)+a-b}{\tan ^2(e+f x)+1}d\tan (e+f x)-\frac {(a-b) \tan (e+f x)}{2 \left (\tan ^2(e+f x)+1\right )}}{f}\) |
\(\Big \downarrow \) 25 |
\(\displaystyle \frac {\frac {1}{2} \int \frac {2 b \tan ^2(e+f x)+a-b}{\tan ^2(e+f x)+1}d\tan (e+f x)-\frac {(a-b) \tan (e+f x)}{2 \left (\tan ^2(e+f x)+1\right )}}{f}\) |
\(\Big \downarrow \) 299 |
\(\displaystyle \frac {\frac {1}{2} \left ((a-3 b) \int \frac {1}{\tan ^2(e+f x)+1}d\tan (e+f x)+2 b \tan (e+f x)\right )-\frac {(a-b) \tan (e+f x)}{2 \left (\tan ^2(e+f x)+1\right )}}{f}\) |
\(\Big \downarrow \) 216 |
\(\displaystyle \frac {\frac {1}{2} ((a-3 b) \arctan (\tan (e+f x))+2 b \tan (e+f x))-\frac {(a-b) \tan (e+f x)}{2 \left (\tan ^2(e+f x)+1\right )}}{f}\) |
(((a - 3*b)*ArcTan[Tan[e + f*x]] + 2*b*Tan[e + f*x])/2 - ((a - b)*Tan[e + f*x])/(2*(1 + Tan[e + f*x]^2)))/f
3.1.38.3.1 Defintions of rubi rules used
Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(1/(Rt[a, 2]*Rt[b, 2]))*A rcTan[Rt[b, 2]*(x/Rt[a, 2])], x] /; FreeQ[{a, b}, x] && PosQ[a/b] && (GtQ[a , 0] || GtQ[b, 0])
Int[((a_) + (b_.)*(x_)^2)^(p_)*((c_) + (d_.)*(x_)^2), x_Symbol] :> Simp[d*x *((a + b*x^2)^(p + 1)/(b*(2*p + 3))), x] - Simp[(a*d - b*c*(2*p + 3))/(b*(2 *p + 3)) Int[(a + b*x^2)^p, x], x] /; FreeQ[{a, b, c, d}, x] && NeQ[b*c - a*d, 0] && NeQ[2*p + 3, 0]
Int[(x_)^(m_)*((a_) + (b_.)*(x_)^2)^(p_)*((c_) + (d_.)*(x_)^2), x_Symbol] : > Simp[(-a)^(m/2 - 1)*(b*c - a*d)*x*((a + b*x^2)^(p + 1)/(2*b^(m/2 + 1)*(p + 1))), x] + Simp[1/(2*b^(m/2 + 1)*(p + 1)) Int[(a + b*x^2)^(p + 1)*Expan dToSum[2*b*(p + 1)*x^2*Together[(b^(m/2)*x^(m - 2)*(c + d*x^2) - (-a)^(m/2 - 1)*(b*c - a*d))/(a + b*x^2)] - (-a)^(m/2 - 1)*(b*c - a*d), x], x], x] /; FreeQ[{a, b, c, d}, x] && NeQ[b*c - a*d, 0] && LtQ[p, -1] && IGtQ[m/2, 0] & & (IntegerQ[p] || EqQ[m + 2*p + 1, 0])
Int[sin[(e_.) + (f_.)*(x_)]^(m_)*((a_) + (b_.)*((c_.)*tan[(e_.) + (f_.)*(x_ )])^(n_))^(p_.), x_Symbol] :> With[{ff = FreeFactors[Tan[e + f*x], x]}, Sim p[c*(ff^(m + 1)/f) Subst[Int[x^m*((a + b*(ff*x)^n)^p/(c^2 + ff^2*x^2)^(m/ 2 + 1)), x], x, c*(Tan[e + f*x]/ff)], x]] /; FreeQ[{a, b, c, e, f, n, p}, x ] && IntegerQ[m/2]
Time = 0.22 (sec) , antiderivative size = 81, normalized size of antiderivative = 1.76
method | result | size |
derivativedivides | \(\frac {a \left (-\frac {\sin \left (f x +e \right ) \cos \left (f x +e \right )}{2}+\frac {f x}{2}+\frac {e}{2}\right )+b \left (\frac {\sin \left (f x +e \right )^{5}}{\cos \left (f x +e \right )}+\left (\sin \left (f x +e \right )^{3}+\frac {3 \sin \left (f x +e \right )}{2}\right ) \cos \left (f x +e \right )-\frac {3 f x}{2}-\frac {3 e}{2}\right )}{f}\) | \(81\) |
default | \(\frac {a \left (-\frac {\sin \left (f x +e \right ) \cos \left (f x +e \right )}{2}+\frac {f x}{2}+\frac {e}{2}\right )+b \left (\frac {\sin \left (f x +e \right )^{5}}{\cos \left (f x +e \right )}+\left (\sin \left (f x +e \right )^{3}+\frac {3 \sin \left (f x +e \right )}{2}\right ) \cos \left (f x +e \right )-\frac {3 f x}{2}-\frac {3 e}{2}\right )}{f}\) | \(81\) |
risch | \(\frac {a x}{2}-\frac {3 b x}{2}+\frac {i {\mathrm e}^{2 i \left (f x +e \right )} a}{8 f}-\frac {i {\mathrm e}^{2 i \left (f x +e \right )} b}{8 f}-\frac {i {\mathrm e}^{-2 i \left (f x +e \right )} a}{8 f}+\frac {i {\mathrm e}^{-2 i \left (f x +e \right )} b}{8 f}+\frac {2 i b}{f \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right )}\) | \(94\) |
1/f*(a*(-1/2*sin(f*x+e)*cos(f*x+e)+1/2*f*x+1/2*e)+b*(sin(f*x+e)^5/cos(f*x+ e)+(sin(f*x+e)^3+3/2*sin(f*x+e))*cos(f*x+e)-3/2*f*x-3/2*e))
Time = 0.29 (sec) , antiderivative size = 54, normalized size of antiderivative = 1.17 \[ \int \sin ^2(e+f x) \left (a+b \tan ^2(e+f x)\right ) \, dx=\frac {{\left (a - 3 \, b\right )} f x \cos \left (f x + e\right ) - {\left ({\left (a - b\right )} \cos \left (f x + e\right )^{2} - 2 \, b\right )} \sin \left (f x + e\right )}{2 \, f \cos \left (f x + e\right )} \]
1/2*((a - 3*b)*f*x*cos(f*x + e) - ((a - b)*cos(f*x + e)^2 - 2*b)*sin(f*x + e))/(f*cos(f*x + e))
\[ \int \sin ^2(e+f x) \left (a+b \tan ^2(e+f x)\right ) \, dx=\int \left (a + b \tan ^{2}{\left (e + f x \right )}\right ) \sin ^{2}{\left (e + f x \right )}\, dx \]
Time = 0.30 (sec) , antiderivative size = 51, normalized size of antiderivative = 1.11 \[ \int \sin ^2(e+f x) \left (a+b \tan ^2(e+f x)\right ) \, dx=\frac {{\left (f x + e\right )} {\left (a - 3 \, b\right )} + 2 \, b \tan \left (f x + e\right ) - \frac {{\left (a - b\right )} \tan \left (f x + e\right )}{\tan \left (f x + e\right )^{2} + 1}}{2 \, f} \]
Leaf count of result is larger than twice the leaf count of optimal. 368 vs. \(2 (42) = 84\).
Time = 0.46 (sec) , antiderivative size = 368, normalized size of antiderivative = 8.00 \[ \int \sin ^2(e+f x) \left (a+b \tan ^2(e+f x)\right ) \, dx=\frac {a f x \tan \left (f x\right )^{3} \tan \left (e\right )^{3} - 3 \, b f x \tan \left (f x\right )^{3} \tan \left (e\right )^{3} + a f x \tan \left (f x\right )^{3} \tan \left (e\right ) - 3 \, b f x \tan \left (f x\right )^{3} \tan \left (e\right ) - a f x \tan \left (f x\right )^{2} \tan \left (e\right )^{2} + 3 \, b f x \tan \left (f x\right )^{2} \tan \left (e\right )^{2} + a f x \tan \left (f x\right ) \tan \left (e\right )^{3} - 3 \, b f x \tan \left (f x\right ) \tan \left (e\right )^{3} + a \tan \left (f x\right )^{3} \tan \left (e\right )^{2} - 3 \, b \tan \left (f x\right )^{3} \tan \left (e\right )^{2} + a \tan \left (f x\right )^{2} \tan \left (e\right )^{3} - 3 \, b \tan \left (f x\right )^{2} \tan \left (e\right )^{3} - a f x \tan \left (f x\right )^{2} + 3 \, b f x \tan \left (f x\right )^{2} + a f x \tan \left (f x\right ) \tan \left (e\right ) - 3 \, b f x \tan \left (f x\right ) \tan \left (e\right ) - a f x \tan \left (e\right )^{2} + 3 \, b f x \tan \left (e\right )^{2} - 2 \, b \tan \left (f x\right )^{3} - 2 \, a \tan \left (f x\right )^{2} \tan \left (e\right ) - 2 \, a \tan \left (f x\right ) \tan \left (e\right )^{2} - 2 \, b \tan \left (e\right )^{3} - a f x + 3 \, b f x + a \tan \left (f x\right ) - 3 \, b \tan \left (f x\right ) + a \tan \left (e\right ) - 3 \, b \tan \left (e\right )}{2 \, {\left (f \tan \left (f x\right )^{3} \tan \left (e\right )^{3} + f \tan \left (f x\right )^{3} \tan \left (e\right ) - f \tan \left (f x\right )^{2} \tan \left (e\right )^{2} + f \tan \left (f x\right ) \tan \left (e\right )^{3} - f \tan \left (f x\right )^{2} + f \tan \left (f x\right ) \tan \left (e\right ) - f \tan \left (e\right )^{2} - f\right )}} \]
1/2*(a*f*x*tan(f*x)^3*tan(e)^3 - 3*b*f*x*tan(f*x)^3*tan(e)^3 + a*f*x*tan(f *x)^3*tan(e) - 3*b*f*x*tan(f*x)^3*tan(e) - a*f*x*tan(f*x)^2*tan(e)^2 + 3*b *f*x*tan(f*x)^2*tan(e)^2 + a*f*x*tan(f*x)*tan(e)^3 - 3*b*f*x*tan(f*x)*tan( e)^3 + a*tan(f*x)^3*tan(e)^2 - 3*b*tan(f*x)^3*tan(e)^2 + a*tan(f*x)^2*tan( e)^3 - 3*b*tan(f*x)^2*tan(e)^3 - a*f*x*tan(f*x)^2 + 3*b*f*x*tan(f*x)^2 + a *f*x*tan(f*x)*tan(e) - 3*b*f*x*tan(f*x)*tan(e) - a*f*x*tan(e)^2 + 3*b*f*x* tan(e)^2 - 2*b*tan(f*x)^3 - 2*a*tan(f*x)^2*tan(e) - 2*a*tan(f*x)*tan(e)^2 - 2*b*tan(e)^3 - a*f*x + 3*b*f*x + a*tan(f*x) - 3*b*tan(f*x) + a*tan(e) - 3*b*tan(e))/(f*tan(f*x)^3*tan(e)^3 + f*tan(f*x)^3*tan(e) - f*tan(f*x)^2*ta n(e)^2 + f*tan(f*x)*tan(e)^3 - f*tan(f*x)^2 + f*tan(f*x)*tan(e) - f*tan(e) ^2 - f)
Time = 10.04 (sec) , antiderivative size = 41, normalized size of antiderivative = 0.89 \[ \int \sin ^2(e+f x) \left (a+b \tan ^2(e+f x)\right ) \, dx=\frac {b\,\mathrm {tan}\left (e+f\,x\right )-\sin \left (2\,e+2\,f\,x\right )\,\left (\frac {a}{4}-\frac {b}{4}\right )+f\,x\,\left (\frac {a}{2}-\frac {3\,b}{2}\right )}{f} \]